package com.qdu.service.impl;


import com.qdu.entity.Commentinfo;
import com.qdu.mapper.CommentinfoMapper;
import com.qdu.service.CommentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.Date;
import java.util.List;
import java.util.UUID;

@Service
@Transactional
public class CommentServiceImpl implements CommentService {

    @Autowired
    private CommentinfoMapper commentinfoMapper;

    @Override
    public void deleteComment(String cid) {
        commentinfoMapper.deleteByPrimaryKey(cid);
    }

    @Override
    public void addComment(Commentinfo record) {
        commentinfoMapper.insert(record);
    }

    @Override
    public List<Commentinfo> getCommentByUid(String uid) {
        return commentinfoMapper.selectByUid(uid);
    }

    @Override
    public List<Commentinfo> getCommentByHid(String hid) {
        return commentinfoMapper.selectByHid(hid);
    }

    @Override
    public Commentinfo getCommentByCid(String cid) {
        return commentinfoMapper.selectByCid(cid);
    }

    @Override
    public void updateCommentBySelective(Commentinfo record) {
        commentinfoMapper.updateByPrimaryKeySelective(record);
    }

    @Override
    public void updateComment(Commentinfo record) {
        commentinfoMapper.updateByPrimaryKey(record);
    }
}
